package org.dftproject.genesis.ui.agents.actions;

import org.dftproject.genesis.ui.agents.pages.AgentsPage;
import org.dftproject.genesis.ui.agents.pages.AgentsPageInput;
import org.dftproject.genesis.ui.pages.PageManager;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;

public class OpenAgentsActionDelegate implements IWorkbenchWindowActionDelegate {

	private IWorkbenchWindow window;
	
	public void init(IWorkbenchWindow window) {
		this.window = window;
	}

	public void run(IAction action) {
		if (window != null) {	
			IWorkbenchPage workbenchPage = window.getActivePage();
			PageManager.getDefault().openPage(workbenchPage, new AgentsPageInput(), AgentsPage.ID, true, false);
		}
	}

	public void selectionChanged(IAction action, ISelection selection) {
	}
	
	public void dispose() {
	}

}
